<?php
/**
 * Created by PhpStorm.
 * User: yui
 * Date: 2017/5/14
 * Time: 15:03
 */

namespace api\controllers;

use Yii;
use common\controllers\ApiCommonCtrl;
use common\services\BusinessSve;

class BusinessController extends ApiCommonCtrl
{
    public function actionRegister()
    {
        $post = Yii::$app->request->post();
        //过滤字段
        $data = $this->filterFields($post, ['mobile', 'password', 'business_name', 'nickname', 'truename', 'email', 'avatar', 'identity', 'sex', 'birthday', 'email_subscriptions']);
        $BusinessSve = new BusinessSve();
        return $BusinessSve->add($data);
    }

    public function actionLogin()
    {
        $BusinessSve = new BusinessSve();
        return $BusinessSve->login(Yii::$app->request->post());
    }

    public function actionLogout()
    {
        $BusinessSve = new BusinessSve();
        return $BusinessSve->logout();
    }
}